﻿using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using WeightWS.Lib;

namespace VzLPRTest
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        private 车牌识别操作类 车牌识别操作1;
        public MainWindow()
        {
            InitializeComponent();
            VzClientSDK.VzLPRClient_Setup();
        }

        public int 打开设备(string ip, int port, string account, string passowrd)
        {
            return VzClientSDK.VzLPRClient_Open(ip, (ushort)port, account, passowrd);
        }

        public void 打开一号摄像头()
        {
            车牌识别操作1 = new 车牌识别操作类();
            车牌识别操作1.连接服务("192.168.0.212", 80, "admin", "admin", this);
            车牌识别操作1.开设备委托 += 打开设备;
        }

        private void open1(object sender, RoutedEventArgs e)
        {
            打开一号摄像头();
        }

        private void close1(object sender, RoutedEventArgs e)
        {
            车牌识别操作1?.结束任务();
        }
    }
}
